package com.huamoxi.result;

import com.huamoxi.consts.ResponseConst;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result<T> {
    private Integer code;
    private String message;
    private T data;

    public Result (int code, String msg) {
        this.code = code;
        this.message = msg;
    }

    public Result (T data) {
        this.code = ResponseConst.SUCCESS_CODE;
        this.message = ResponseConst.SUCCESS_MESSAGE;
        this.data = data;
    }

    public Result (String message, T data) {
        this.code = ResponseConst.SUCCESS_CODE;
        this.message = message;
        this.data = data;
    }

    public Result (int code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }
}
